/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servercom;

/**
 *
 * @author Administrator
 */
public class FKDAO {
AttributeDAO _fkSource;
AttributeDAO _fkDest;
TableDAO _fkTBDest;
private TableDAO _fkTBSource;

    public AttributeDAO getFkDest() {
        return _fkDest;
    }

    public void setFkDest(AttributeDAO _fkDest) {
        this._fkDest = _fkDest;
    }

    public AttributeDAO getFkSource() {
        return _fkSource;
    }

    public void setFkSource(AttributeDAO _fkSource) {
        this._fkSource = _fkSource;
    }

    public TableDAO getFkTBDest() {
        return _fkTBDest;
    }

    public void setFkTBDest(TableDAO _fkTBDest) {
        this._fkTBDest = _fkTBDest;
    }

    /**
     * @return the _fkTBSource
     */
    public TableDAO getFkTBSource() {
        return _fkTBSource;
    }

    /**
     * @param fkTBSource the _fkTBSource to set
     */
    public void setFkTBSource(TableDAO fkTBSource) {
        this._fkTBSource = fkTBSource;
    }
    
    public FKDAO(TableDAO tbsource , TableDAO tbdest , AttributeDAO atsource , AttributeDAO atdest)
    {
        _fkTBDest = tbdest;
        _fkTBSource = tbsource;
        _fkDest = atdest;
        _fkSource = atsource;
    }
    
    //tìm kiếm xem có dữ liệu nào trỏ qua không
    public boolean CheckForeignKey(CellDAO tcell , int indexField)
    {
        for (int j = 0; j < _fkTBSource._lstRecord.size(); j++) {
                CellDAO t = _fkTBSource._lstRecord.get(j).getLstCell().get(indexField);
                if(t.Compare(tcell))
                {
                    return true;
                }
        }
        return false;
    }
}
